Method and apparatus for performing motion recognition using motion sensor fusion, and associated computer program product

ABSTRACT

A method and apparatus for performing motion recognition using motion sensor fusion and an associated computer program product are provided, where the method is applied to an electronic device. The method includes the steps of: utilizing a plurality of motion sensors of the electronic device to obtain sensor data respectively corresponding to the plurality of motion sensors, the sensor data measured at a device coordinate system of the electronic device, wherein the plurality of motion sensors includes inertial motion sensors; and performing sensor fusion according to the sensor data by converting at least one portion of the sensor data and derivatives of the sensor data into converted data based on a global coordinate system of a user of the electronic device, to perform motion recognition based on the global coordinate system, in order to recognize the user&#39;s motion.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation application, which claims the benefitof and priority to U.S. application Ser. No. 15/613,426, filed on Jun.5, 2017, which is a continuation application, which claims the benefitof and priority to U.S. application Ser. No. 13/762,405, filed on Feb.8, 2013 (now patented as U.S. Pat. No. 9,690,386, issued Jun. 27, 2017),which claims the benefit of U.S. Provisional Application No. 61/597,144,which was filed on Feb. 9, 2012 and is entitled “Motion RecognitionUsing Motion Sensor Fusion”. The entirety of each of the above-mentionedpriority applications is incorporated herein by reference and made apart of this specification. In addition, U.S. application Ser. No.13/762,405 is a continuation-in-part application of, and claims thebenefit of, each of three U.S. patent application Ser. No. 13/072,794(which was filed on Mar. 28, 2011 and is entitled “ELECTRONIC DEVICE FORUSE IN MOTION DETECTION AND METHOD FOR OBTAINING RESULTANT DEVIATIONTHEREOF”, now patented as U.S. Pat. No. 9,760,186), Ser. No. 12/943,934(which was filed on Nov. 11, 2010 and is entitled “3D POINTING DEVICEAND METHOD FOR COMPENSATING MOVEMENT THEREOF”, now patented as U.S. Pat.No. 8,441,438), and Ser. No. 13/164,790 (which was filed on Jun. 21,2011 and is entitled “METHOD AND APPARATUS FOR PROVIDING MOTIONLIBRARY”, now patented as U.S. Pat. No. 8,847,880), where the entiretyof each of the above-mentioned three U.S. patent applications isincorporated herein by reference and made a part of this specification.Additionally, the U.S. patent application Ser. No. 13/072,794 is acontinuation-in-part application of the U.S. patent application Ser. No.12/943,934 (now patented as U.S. Pat. No. 8,441,438), and the U.S.patent application Ser. No. 12/943,934 claims the benefit of U.S.Provisional Application No. 61/292,558, which was filed on Jan. 6, 2010,while the U.S. patent application Ser. No. 13/164,790 is acontinuation-in-part application of the U.S. patent application Ser. No.12/647,397, which was filed on Dec. 25, 2009, and the U.S. patentapplication Ser. No. 12/647,397 claims the benefit of U.S. ProvisionalApplication No. 61/225,555, which was filed on Jul. 14, 2009.

BACKGROUND OF THE INVENTION 1. Field of the Invention

The present invention relates to motion recognition of a portableelectronic device, and more particularly, to a method for performingmotion recognition using motion sensor fusion, and to an associatedapparatus and an associated computer program product.

2. Description of the Prior Art

According to the related art, it seems unlikely that there aresufficient implementation details of conventional motion recognitionmethods. When trying to apply the conventional motion recognitionmethods, some problems may occur. For example, regarding the motionsrespectively shown in FIG. 1 and FIG. 2, such as the swing motion towardthe “Right” direction with translation plus rotation with respect to the“−z”-axis and the swing motion toward the “Right” direction withtranslation plus rotation with respect to the “−z”-axis plus overturningwith respect to the “+y”-axis, when only G-sensors are utilized, thechange between linear acceleration and gravity acceleration cannot bedecoupled. More specifically, referring to FIG. 3 which illustrates thedata curves of G-sensor outputs (more particularly, acceleration dataax, ay, and az corresponding to three axes, respectively) for themotions respectively shown in FIG. 1 and FIG. 2, with the upper half andthe lower half of FIG. 3 respectively corresponding to FIG. 1 and FIG.2, although these two motions are in the same direction and have thesame translation measurement, they cannot be identified according to theG-sensor outputs. In another example, regarding the motion shown in FIG.2, when only Gyro sensors are utilized, the translation motion cannot besensed, where only relative angle can be measured. In another example,regarding the motion shown in FIG. 2, when only magnetic sensors areutilized, the translation motion cannot be sensed, where no anglechanges measured according to global coordinate are available. Thus, anovel method is required for providing sufficient implementation detailsof motion recognition.

SUMMARY OF THE INVENTION

It is therefore an objective of the claimed invention to provide amethod for performing motion recognition using motion sensor fusion, andto provide an associated apparatus and an associated computer programproduct, in order to solve the above-mentioned problems.

It is another objective of the claimed invention to provide a method forperforming motion recognition using motion sensor fusion, and to providean associated apparatus and an associated computer program product, inorder to obtain accurate motion recognition results, for the user'sconvenience during controlling the electronic device.

According to at least one preferred embodiment, a method for performingmotion recognition using motion sensor fusion is provided, where themethod is applied to an electronic device. The method comprises thesteps of: utilizing a plurality of motion sensors of the electronicdevice to obtain sensor data respectively corresponding to the pluralityof motion sensors, the sensor data measured at a device coordinatesystem of the electronic device, wherein the plurality of motion sensorscomprises inertial motion sensors; and performing sensor fusionaccording to the sensor data by converting at least one portion of thesensor data and derivatives of the sensor data into converted data basedon a global coordinate system of a user of the electronic device, toperform motion recognition based on the global coordinate system, inorder to recognize the user's motion.

According to at least one preferred embodiment, an associated computerprogram product having program instructions is provided, where theprogram instructions are utilized for instructing a processor of anelectronic device to perform a method comprising the steps of: utilizinga plurality of motion sensors of the electronic device to obtain sensordata respectively corresponding to the plurality of motion sensors, thesensor data measured at a device coordinate system of the electronicdevice, wherein the plurality of motion sensors comprises inertialmotion sensors; and performing sensor fusion according to the sensordata by converting at least one portion of the sensor data andderivatives of the sensor data into converted data based on a globalcoordinate system of a user of the electronic device, to perform motionrecognition based on the global coordinate system, in order to recognizethe user's motion.

According to at least one preferred embodiment, an apparatus forperforming motion recognition using motion sensor fusion is alsoprovided, where the apparatus comprises at least one portion of anelectronic device. The apparatus comprises a storage module, a motionsensing module, and at least one processor, which is coupled to thestorage module and the motion sensing module. The storage module isarranged to store information of at least one database for use ofperforming motion recognition. In addition, the motion sensing modulecomprises a plurality of motion sensors positioned within the electronicdevice, wherein the plurality of motion sensors comprises inertialmotion sensors. Additionally, the at least one processor is arranged toexecute program instructions to perform a method comprising the stepsof: utilizing the plurality of motion sensors of the electronic deviceto obtain sensor data respectively corresponding to the plurality ofmotion sensors, the sensor data measured at a device coordinate systemof the electronic device; and performing sensor fusion according to thesensor data by converting at least one portion of the sensor data andderivatives of the sensor data into converted data based on a globalcoordinate system of a user of the electronic device, to perform motionrecognition based on the global coordinate system, with aid of the atleast one database, in order to recognize the user's motion.

It is one advantage of the present invention that the aforementionedmethod, the aforementioned apparatus, and the aforementioned computerprogram product can reach high accuracy during motion recognition. As aresult of obtaining accurate motion recognition results, the user canutilize and control the electronic device easily. In addition, theaforementioned method, the aforementioned apparatus, and theaforementioned computer program product allow the user to control theelectronic device by utilizing some pre-defined/user-defined gestures ofmoving the electronic device, having no need to use many finger-touchedsteps for enabling a specific application (such as a navigationapplication).

These and other objectives of the present invention will no doubt becomeobvious to those of ordinary skill in the art after reading thefollowing detailed description of the preferred embodiment that isillustrated in the various figures and drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates a swing motion toward the “Right” direction withtranslation plus rotation with respect to the “−z”-axis.

FIG. 2 illustrates a swing motion toward the “Right” direction withtranslation plus rotation with respect to the “−z”-axis plus overturningwith respect to the “+y”-axis.

FIG. 3 illustrates some data curves of G-sensor outputs for the motionsrespectively shown in FIG. 1 and FIG. 2, where the upper half and thelower half of FIG. 3 correspond to the motion shown in FIG. 1 and themotion shown in FIG. 2, respectively.

FIG. 4 is a diagram of an apparatus for performing motion recognitionusing motion sensor fusion according to a first embodiment of thepresent invention.

FIG. 5 illustrates a control scheme involved with the apparatus 100shown in FIG. 4 according to an embodiment of the present invention.

FIG. 6 illustrates a global coordinate system and a device coordinatesystem involved with a method mentioned in the embodiment shown in FIG.4.

FIG. 7 illustrates some data curves of G-sensor outputs for the samemotion carried out by the user with the electronic device being held atdifferent tile angles such as those shown in FIG. 6 according to anembodiment of the present invention.

FIG. 8 is a working flow of the method mentioned in the embodiment shownin FIG. 4 according to an embodiment of the present invention.

FIG. 9 illustrates the coordinate definition of the global coordinatesystem mentioned in the embodiment shown in FIG. 6 and the associatedroll angle, the associated pitch angle, and the associated yaw angle.

FIG. 10 illustrates some implementation details of obtaining the linearacceleration and rotation angles by using one of some sensor fusionalgorithms of the method mentioned in the embodiment shown in FIG. 4according to another embodiment of the present invention.

FIG. 11 illustrates the user's motion and the associated relationshipsin the body coordinate system and the global coordinate system accordingto an embodiment of the present invention.

FIG. 12 illustrates some motions carried out and detected referring tothe global coordinate system according to an embodiment of the presentinvention.

FIG. 13 illustrates a certain motion generated referring to the globalcoordinate system according to another embodiment of the presentinvention.

FIG. 14 illustrates the same motion as that shown in FIG. 13 indifferent situations.

FIG. 15 illustrates a certain motion generated referring to the globalcoordinate system according to another embodiment of the presentinvention.

FIG. 16 illustrates the same motion as that shown in FIG. 15 indifferent situations.

FIG. 17 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to an embodiment of the presentinvention.

FIG. 18 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 19 illustrates some relationships between a plurality of motionsand the associated motion data in a user-defined motion recognitiondatabase according to an embodiment of the present invention.

FIG. 20 illustrates some relationships between the associated motiondata respectively corresponding to the plurality of motions mentioned inthe embodiment shown in FIG. 19 and the associated sets of macrofunctions within at least one database of the apparatus shown in FIG. 4.

FIG. 21 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 22 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 23 illustrates some implementation details of a step shown in FIG.21 according to an embodiment of the present invention.

FIG. 24 illustrates some implementation details of another step shown inFIG. 21 according to the embodiment shown in FIG. 23.

FIG. 25 illustrates some implementation details of another step shown inFIG. 21 according to the embodiment shown in FIG. 23.

FIG. 26 illustrates some implementation details involved with theworking flow shown in FIG. 22 according to another embodiment of thepresent invention.

FIG. 27 illustrates a plurality of finger-touched steps for enabling aspecific application according an embodiment of the present invention.

FIG. 28 illustrates some implementation details of multi-steps functiondefinition including enabling a Global Positioning System (GPS) functionaccording to another embodiment of the present invention.

FIG. 29 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 30 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 31 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 32 is a working flow involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

FIG. 33 illustrates some trajectories detected by single/multi-strokecharacter motion recognition involved with the method mentioned in theembodiment shown in FIG. 4 according to an embodiment of the presentinvention.

FIG. 34 illustrates hand-writing motions having pitch and yaw anglechanges with respect to time and the associated projection on an XZplane of the global coordinate system according to the embodiment shownin FIG. 33.

FIG. 35 illustrates the Spherical-Cartesian transformation according tothe embodiment shown in FIG. 33.

FIG. 36 illustrates trajectory data extraction corresponding to theprojection on the XZ plane of the global coordinate system for theaforementioned single/multi-stroke character motion recognition of theembodiment shown in FIG. 33 according to an embodiment of the presentinvention.

FIG. 37 illustrates trajectory data extraction corresponding to theprojection on an XY plane of the global coordinate system for theaforementioned single/multi-stroke character motion recognition of theembodiment shown in FIG. 33 according to another embodiment of thepresent invention.

FIG. 38 illustrates some characters drawn by the user and the associatedstroke counts involved with the aforementioned single/multi-strokecharacter motion recognition of the embodiment shown in FIG. 33according to an embodiment of the present invention.

FIG. 39 is a working flow involved with the aforementionedsingle/multi-stroke character motion recognition of the embodiment shownin FIG. 33 according to an embodiment of the present invention.

FIG. 40 is a working flow involved with the aforementionedsingle/multi-stroke character motion recognition of the embodiment shownin FIG. 33 according to another embodiment of the present invention.

DETAILED DESCRIPTION

Please refer to FIG. 4, which illustrates a diagram of an apparatus 100for performing motion recognition using motion sensor fusion accordingto a first embodiment of the present invention, where the apparatuscomprises at least one portion (e.g. a portion or all) of an electronicdevice. For example, the apparatus 100 can be the whole of theelectronic device mentioned above. For better comprehension, theapparatus 100 shown in FIG. 4 can be regarded as a handheld device. Thisis for illustrative purposes only, and is not meant to be a limitationof the present invention. In another example, the apparatus 100 mayinclude a portion of the electronic device mentioned above, and moreparticularly, can be a control circuit such as an integrated circuit(IC) within the electronic device. Examples of the electronic device mayinclude, but not limited to, a mobile phone (e.g. a multifunctionalmobile phone), a mobile computer (e.g. tablet computer), or a personaldigital assistant (PDA).

As shown in FIG. 4, the apparatus 100 may include a processing module110 and a recognition module 120, both of which can be implemented by aprocessing circuit having at least one processor (e.g. at least oneCentral Processing Unit (CPU)) executing program instructions of programmodules (e.g. software modules), respectively. For example, the programmodules may be provided through a computer program product having theaforementioned program instructions, where the computer program productmay be implemented as a non-transitory computer-readable medium (e.g. afloppy disk or a compact disc-read only memory (CD-ROM)) storing theprogram instructions. The apparatus 100 may further include a motionsensing module 130, a storage module such as the memory module 140, anon-motion sensing module 150, a keypad module 160, and a display module170. In addition, the motion sensing module 130 may include a pluralityof motion sensors positioned within the electronic device (e.g.accelerometers, Gyro sensors, and/or compass sensors), where theplurality of motion sensors typically comprises inertial motion sensors.The memory module 140 may include at least one database for storing anykind of final results, raw data and intermediate values during operationof motion recognition. More particularly, the memory module 140 can beimplemented by at least one non-volatile memory such as at least oneFlash memory, where the aforementioned storage module such as the memorymodule 140 is arranged to store information of the database for use ofperforming motion recognition. Additionally, the non-motion sensingmodule 150 may include at least one of an Radio Frequency (RF) sensor, acamera sensor, and a microphone sensor, while the keypad module 160 mayinclude some keys and/or buttons, for purpose of controlling theelectronic device, and the display module 170 can be a touch-sensitivedisplay panel (which can be referred to as the touch panel, forbrevity).

According to this embodiment, the processor is arranged to execute theprogram instructions mentioned above to perform a method for performingmotion recognition using motion sensor fusion, where the method mayinclude the steps of: utilizing the plurality of motion sensors of theelectronic device to obtain sensor data respectively corresponding tothe plurality of motion sensors, the sensor data measured at a devicecoordinate system (or body coordinate system) of the electronic device;and performing sensor fusion according to the sensor data by convertingat least one portion of the sensor data and derivatives of the sensordata into converted data based on a global coordinate system of a userof the electronic device, to perform motion recognition based on theglobal coordinate system, with aid of the aforementioned at least onedatabase, in order to recognize the user's motion.

For example, the plurality of motion sensors comprises at least oneaccelerometer (e.g. at least one G-sensor) and at least one rotationsensor (e.g. at least one Gyro sensor), such as three accelerometers andthree rotation sensors, and the sensor fusion may comprise six-axissensor fusion that is accomplished by utilizing the aforementioned atleast one accelerometer and the aforementioned at least one rotationsensor. For some implementation details regarding the six-axis sensorfusion mentioned above, please refer to the U.S. patent application Ser.No. 12/943,934 of the above-mentioned three U.S. patent applications.

In another example, the plurality of motion sensors comprises theaforementioned at least one accelerometer (e.g. at least one G-sensor),the aforementioned at least one rotation sensor (e.g. at least one Gyrosensor), and at least one magnetometer (e.g. at least one magneticsensor), and the sensor fusion may comprise nine-axis sensor fusion thatis accomplished by utilizing the aforementioned at least oneaccelerometer, the aforementioned at least one rotation sensor, and theaforementioned at least one magnetometer. For some implementationdetails regarding the nine-axis sensor fusion mentioned above, pleaserefer to the U.S. patent application Ser. No. 13/072,794 of theabove-mentioned three U.S. patent applications.

In practice, there are multiple methods for implementing at least oneportion of the database. For example, for some implementation detailsregarding the database, please refer to the U.S. patent application Ser.No. 13/164,790 of the above-mentioned three U.S. patent applications.

According to a variation of the embodiment shown in FIG. 1, theprocessor may perform sensor fusion according to the sensor data toobtain motion data based on the device coordinate system and to obtainorientation of the electronic device, such as the orientation based onthe global coordinate system, where the motion data based on the devicecoordinate system comprise linear acceleration based on the devicecoordinate system. In addition, the processor may convert the motiondata based on the device coordinate system into at least one portion ofthe converted data according to the orientation based on the globalcoordinate system, where the aforementioned at least one portion of theconverted data comprise linear acceleration based on the globalcoordinate system, and the linear acceleration based on the globalcoordinate system and the orientation based on the global coordinatesystem are utilized for sensing linear translation and rotation motionof the electronic device respectively in three-dimensional (3D) space.More particularly, according to the converted data based on the globalcoordinate system, the processor can perform motion recognition torecognize the user's motion in the 3D space and at least one characterdrawn by the user in the 3D space. For example, the processor mayperform character recognition by mapping the converted data onto atleast one predetermined plane of the 3D space to obtain trajectories onthe aforementioned at least one predetermined plane, where theaforementioned at least one predetermined plane is parallel to two ofthree axes of the global coordinate system, and the three axes of theglobal coordinate system are orthogonal to each other. In a situationwhere the database comprises a pre-built database, the pre-builtdatabase can be utilized for performing character recognition, allowingthe user to follow drawing rules corresponding to meaningful charactersto be recognized, without need for the user to train the database inadvance. This is for illustrative purposes only, and is not meant to bea limitation of the present invention. According to another variation ofthis embodiment, the processor may load the aforementioned at least onecharacter drawn by the user in the 3D space into a character recognitionsoftware module, for performing character recognition.

According to some variations of this embodiment, the orientation basedon the global coordinate system comprises a roll angle, a pitch angle,and a yaw angle of the electronic device, and when starting performingcharacter recognition, the processor may align the yaw angle with theuser by resetting the yaw angle of the electronic device to be apredetermined value, such as zero or another fixed value. For example,when it is detected that a button of the electronic device is pressed,the processor triggers to reset the yaw angle of the electronic deviceto be the predetermined value. In another example, when it is detectedthat force corresponding to beginning of the motion exists, theprocessor triggers to reset the yaw angle of the electronic device to bethe predetermined value.

According to some variations of the embodiment shown in FIG. 1, thedatabase comprises a user-defined gesture database, allowing the user totrain the user-defined gesture database with different gestures ofmoving the electronic device by the user, and the user-defined gesturedatabase is utilized for performing motion recognition and triggering anoperation corresponding to a motion recognition result obtained fromperforming motion recognition. For example, according to the converteddata based on the global coordinate system, the processor performsmotion recognition to obtain at least one motion recognition resultrepresenting the user's motion in the 3D space, where when obtaining theat least one motion recognition result, the processor triggers at leastone user-defined macro function corresponding to the at least one motionrecognition result. More particularly, in a situation where theuser-defined gesture database is provided, the processor allows the userto train the user-defined gesture database with different gestures ofmoving the electronic device by the user, where the user-defined gesturedatabase is utilized for performing motion recognition and triggeringthe user-defined macro function corresponding to the at least one motionrecognition result.

FIG. 5 illustrates a control scheme involved with the apparatus 100shown in FIG. 4 according to an embodiment of the present invention,where the control scheme is based on Android's platform implemented inthe handheld device mentioned above. According to this embodiment, theaforementioned program modules whose program instructions are arrangedto be executed by the processor (e.g. CPU) may comprise someapplications, some middle-wares, and at least one kernel driver.Examples of the applications may comprise at least one browser, at leastone E-mail application, at least one phone application, a mapapplication, a home application, and some other applications. Inaddition, examples of the middle-wares may comprise at least oneapplication framework, which may comprise at least onesix-axis/nine-axis (or 6/9-axis) sensor fusion module for performing thesix-axis sensor fusion and/or the nine-axis sensor fusion and mayfurther comprise a motion recognition module (more particularly, therecognition module 120 shown in FIG. 1), where some algorithms of motionrecognition are provided for the API which is called by theapplications. In practice, in addition to the processor, the handhelddevice (more particularly, the apparatus 100) may comprise other typesof hardware, such as G-sensors, Gyro sensors, magnet sensors, at leastone touch panel, at least one camera, a Wireless Fidelity (Wi-Fi)module, a Global Positioning System (GPS) module, a Bluetooth module,and some other modules.

Translation and Rotation Parameters Based on6-Axis(G+Gyro)/9-Axis(G+Gyro+M) Sensor Fusion in Application of MotionRecognition

FIG. 6 illustrates the global coordinate system of the user of theelectronic device and the device coordinate system (or body coordinatesystem) involved with the method mentioned in the embodiment shown inFIG. 4. As shown in FIG. 6, the global coordinate system (i.e. the x-y-zcoordinate system, whose three axes x, y, and z are orthogonal to eachother) remains fixed in the 3D space, while the device coordinate system(i.e. the xb-yb-zb coordinate system, whose three axes xb, yb, and zbare orthogonal to each other) remains fixed on the electronic deviceunder consideration.

FIG. 7 illustrates some data curves of G-sensor outputs for the samemotion carried out by the user (more particularly, the motion of thetranslation toward the “Right” direction in FIG. 6) with the electronicdevice being held at different tile angles such as those shown in FIG. 6according to an embodiment of the present invention, where the leftmost,the central, and the rightmost sets of data curves shown in FIG. 7correspond to the three different tile angles shown in FIG. 6 (moreparticularly, the tile angles illustrated with the leftmost, thecentral, and the rightmost portion of FIG. 6), respectively. In each setof the leftmost, the central, and the rightmost sets of data curvesshown in FIG. 7, there are three curves of the acceleration data ax, ay,and az corresponding to the three axes xb, yb, and zb of the devicecoordinate system, respectively. As shown in FIG. 7, the threeconsecutive states of the motion shown in FIG. 6 may cause differentsensing signal responses, respectively. For example, referring to theleftmost set of data curves shown in FIG. 7, the acceleration data axmay be non-zero, the acceleration data ay may remain zero, and theacceleration data az may remain constant. In another example, referringto the central set of data curves shown in FIG. 7, the acceleration dataax and az may be non-zero, and the acceleration data ay may remain zero.In another example, referring to the rightmost set of data curves shownin FIG. 7, the acceleration data az may be non-zero, the accelerationdata ay may remain zero, and the acceleration data ax may remainconstant. Thus, the acceleration sensed by the G-sensors (moreparticularly, sensed according to the device coordinate system only)will differ from those with different tilt angles. In order to capturefull movement measurements of some object moving in the 3D space, it'snecessary to obtain both translational and rotational parameters of theobject. By performing the six-axis sensor fusion and/or the nine-axissensor fusion, it can be realized.

Please refer to FIG. 8, which illustrates a working flow 200 of themethod mentioned in the embodiment shown in FIG. 4 according to anembodiment of the present invention.

In Step 210, the processor detects motion inputs from the plurality ofmotion sensors, where the motion inputs may comprise the accelerationdata ax, ay, and az of the motion under consideration.

In Step 220, the processor gets translation and rotation parametersbased on body coordinate (more particularly, the body coordinate system)using sensor fusion (e.g. the six-axis sensor fusion and/or thenine-axis sensor fusion).

In Step 230, the processor converts translation and rotation parametersinto those based on the global coordinate system.

In Step 240, the processor runs a motion recognition process usingtranslation and rotation parameters based on the global coordinatesystem.

According to this embodiment, the translation parameters can becalculated according to the data outputs of the motion sensors by usingsensor fusion. As a result, the linear acceleration based on the globalcoordinate system can be obtained. In addition, the rotation parameterscan be calculated according to the data outputs of the motion sensors byusing sensor fusion. As a result, the roll, the yaw, and the pitchangles of the orientation of the electronic device can be obtained.Please note that the two sets of parameters (i.e. the translationparameters and the rotation parameters) can be combined as the basicmotion inputs used for motion recognition.

FIG. 9 illustrates the coordinate definition of the global coordinatesystem mentioned in the embodiment shown in FIG. 6 and the associatedroll angle (.PHI.), the associated pitch angle (.theta.), and theassociated yaw angle (.PSI.). The orientation obtained by one of somesensor fusion algorithms of the method mentioned in the embodiment shownin FIG. 4 can be represented by a combination of the roll angle (.PHI.),the pitch angle (.theta.), and the yaw angle (.PSI.), where thedirections of the “+x”-axis, the “+y”-axis, and the “+z”-axis of theglobal coordinate system are defined as shown in FIG. 9, and can beutilized for defining the roll angle (.PHI.), the pitch angle (.theta.),and the yaw angle (.PSI.) with respect to the global coordinate system.

FIG. 10 illustrates some implementation details of obtaining the linearacceleration and rotation angles by using one of some sensor fusionalgorithms of the method mentioned in the embodiment shown in FIG. 4according to another embodiment of the present invention. The Xg-Yg-Zgcoordinate system can be taken as an example of the global coordinatesystem mentioned in the embodiment shown in FIG. 6. Please note that therespective components g.sub.x, g.sub.y, and g.sub.z of the gravityvector g shown in the left half of FIG. 10 can be written as thefunctions of time t, such as the functions g.sub.x(t), g.sub.y(t), andg.sub.z(t) listed around the bottom left corner of FIG. 10. As shown inthe right half of FIG. 10, the acceleration measured by the motionsensing module 130 based on the device coordinate system can be writtenas a set of functions a.sub.x(t), a.sub.y(t), and a.sub.z(t) (moreparticularly, the vector [a.sub.x(t), a.sub.y(t), a.sub.z(t)]), and thelinear acceleration of the electronic device based on the devicecoordinate system can be written as a set of functions a.sub.Lx(t),a.sub.Ly(t), and a.sub.Lz(t) (more particularly, the vector[a.sub.Lx(t), a.sub.Ly(t), a.sub.Lz(t)]). According to this embodiment,the processor converts the acceleration measured by the motion sensingmodule 130 based on the device coordinate system (e.g. the vector[a.sub.x(t), a.sub.y(t), a.sub.z(t)]) into the linear acceleration ofthe electronic device based on the device coordinate system (e.g. thevector [a.sub.Lx(t), a.sub.Ly(t), a.sub.Lz(t)]) according to thefunctions g.sub.x(t), g.sub.y(t), and g.sub.z(t) listed around thebottom left corner of FIG. 10.

More particularly, the roll, yaw and pitch angles of the orientation ofthe electronic device are calculated based on the global coordinatesystem, and at least one portion of the roll, the yaw and the pitchangles of the orientation can be utilized for calculating the linearacceleration of the electronic device based on the device coordinatesystem (or body coordinate system) of the electronic device such as thehandheld device (e.g. the mobile phone mentioned above), where withinthe functions g.sub.x(t), g.sub.y(t), and g.sub.z(t) listed around thebottom left corner of FIG. 10, the functions g.sub.y(t) and g.sub.z(t)depend on the roll angle, and the functions g.sub.x(t), g.sub.y(t), andg.sub.z(t) depend on the pitch angle.

In practice, the linear acceleration based on the global coordinatesystem can be calculated by the coordinate transformation relationshiprepresented by a rotation matrix [R].sub.3.times.3, and the linearacceleration based on the global coordinate system, such as the vectora.sub.GLOBAL(t) whose components are a.sub.GLOBALx(t), a.sub.GLOBALy(t),and a.sub.GLOBALz(t) (i.e. the vector [a.sub.GLOBALx(t),a.sub.GLOBALy(t), a.sub.GLOBALz(t)]), is equivalent to the linearacceleration based on the device coordinate system, such as the vectora.sub.L(t) whose components are a.sub.Lx(t), a.sub.Ly(t), anda.sub.Lz(t) (i.e. the vector [a.sub.Lx(t), a.sub.Ly(t), a.sub.Lz(t)]),multiplied by the rotation matrix [R].sub.3.times.3. That is, theconversion of the linear acceleration can be performed according to thefollowing equation:a.sub.GLOBAL(t)=a.sub.L(t)*[R].sub.3.times.3;

where the rotation matrix [R].sub.3.times.3 can be a function f(.PHI.,.theta., .PSI.) of the roll, the pitch, and the yaw angles (i.e. .PHI.,.theta., and .PSI., respectively). More particularly, the rotationmatrix [R].sub.3.times.3 can be expressed as follows:[R]3.times.3=[cos .theta. cos .psi.−cos .phi. sin .psi. sin .theta. cos.theta. sin .psi.+cos .phi. cos .psi. sin .theta. sin .theta. sin.phi.−sin .theta. cos .psi.−cos .phi. sin .psi. cos .theta.−sin .theta.sin .psi.+cos .phi. cos .psi. cos .theta. cos .theta. sin .phi. sin.phi. sin .psi.−sin .phi. cos .psi. cos .phi.];  ##EQU00001##

where .PHI. is the roll angle, .theta. is the pitch angle, and .PSI. isthe yaw angle.

FIG. 11 illustrates the user's motion and the associated relationshipsin the body coordinate system (or device coordinate system) and theglobal coordinate system according to an embodiment of the presentinvention, with the body coordinates mapping to the global coordinates.According to this embodiment, one motion is generated by the user andthe motion outputs (e.g. the linear acceleration and orientation)reference to the global coordinate are all in the same coordinate systemof the user (i.e. the global coordinate system). In addition, the wholemotion can be analyzed and recognized correctly based on the samecoordinate system of the user (i.e. the global coordinate system).

FIG. 12 illustrates some motions carried out and detected referring tothe global coordinate system according to an embodiment of the presentinvention. As shown in FIG. 12, in order to perform motion recognitionbased on the global coordinate system, the processor is arranged todetect the changes in the roll, yaw and pitch angles, respectively. Forexample, the processor detects that one of the motions shown in FIG. 12causes the change of the roll angle, and detects that another of themotions shown in FIG. 12 causes the change of the pitch angle, andfurther detects that the other of the motions shown in FIG. 12 causesthe change of the yaw angle.

FIG. 13 illustrates a certain motion generated referring to the globalcoordinate system according to another embodiment of the presentinvention. As shown in FIG. 13, the motion under consideration is a“DOWN” motion, and according to the motion recognition based on theglobal coordinate system, the processor detects a trajectory projectedon a predetermined plane in the global coordinate system (e.g. a firstplane parallel to the x-z plane comprising the x-axis and the z-axis ofthe x-y-z coordinate system) and also detects the start point and theend point of the trajectory. Please refer to FIG. 14, which illustratesthe same motion as that shown in FIG. 13 in different situations. Theuser may take (and move) the electronic device through the same motionat different places A and B, facing toward different directions. Forexample, the user may take (and move) the electronic device through thesame motion as that shown in FIG. 13, except that the user is facingtoward another plane (e.g. a second plane parallel to the y-z planecomprising the y-axis and the z-axis of the x-y-z coordinate system),rather than the plane shown in FIG. 13 (e.g. the first plane parallel tothe x-z plane). Please note that, in response to the same motiongenerated at different places A and B (e.g. at different directions ofdifferent yaw angles), the pitch angle changes of the same motion arethe same referring to the global coordinate system. For example, in thesituation corresponding to the place A, the change of the yaw anglecauses the trajectory on the first plane parallel to the x-z plane tostart from the “+z”-direction and to end at the “−z”-direction. Inanother example, in the situation corresponding to the place B, thechange of the yaw angle causes the trajectory on the second planeparallel to the y-z plane to start from the “+z”-direction and to end atthe “−z”-direction.

According to a variation of this embodiment, when the motion causing thesame pitch angle change is replaced by a rolling motion, in response tothe same rolling motion generated at different places A and B (e.g. atdifferent directions of different yaw angles), the roll angle changes ofthe same motion are the same referring to the global coordinate system.

FIG. 15 illustrates a certain motion generated referring to the globalcoordinate system according to another embodiment of the presentinvention. As shown in FIG. 15, the motion under consideration is a“LEFT” motion, and according to the motion recognition based on theglobal coordinate system, the processor detects a trajectory projectedon a predetermined plane in the global coordinate system (e.g. theaforementioned first plane parallel to the x-z plane) and also detectsthe start point and the end point of the trajectory of this embodiment.Please refer to FIG. 16, which illustrates the same motion as that shownin FIG. 15 in different situations. The user may take (and move) theelectronic device through the same motion at different places A and B,facing toward different directions. For example, the user may take (andmove) the electronic device through the same motion as that shown inFIG. 15, except that the user is facing toward another plane (e.g. theaforementioned second plane parallel to the y-z plane), rather than theplane shown in FIG. 15 (e.g. the aforementioned first plane parallel tothe x-z plane). Please note that, in response to the same motiongenerated at different places A and B (e.g. at different directions ofdifferent yaw angles), the yaw angle changes of the same motion are notthe same referring to the global coordinate system. For example, in thesituation corresponding to the place A, the change of the yaw anglecauses the trajectory on the first plane parallel to the x-z plane tostart from the “+x”-direction and to end at the “−x”-direction. Inanother example, in the situation corresponding to the place B, thechange of the yaw angle causes the trajectory on the second planeparallel to the y-z plane to start from the “+y”-direction and to end atthe “−y”-direction.

FIG. 17 is a working flow 300 involved with the method mentioned in theembodiment shown in FIG. 4 according to an embodiment of the presentinvention, where the working flow 300 is utilized for performingcalibration of the yaw angle by resetting the yaw to be theaforementioned predetermined value, such as zero or another fixed value.

In Step 310, the processor detects that the user presses and holds abutton, and therefore the processor prepares for recording the motionand performing motion recognition, where pressing and holding thisbutton is utilized as a command to start recording the motion to performmotion recognition.

In Step 320, the processor sets the current yaw angle referring to theglobal coordinate system to be zero. As a result, the problem that theyaw angle changes of the same motion are not the same in differentsituations (with respect to different initial values of the yaw angle inthese situations) can be prevented.

In Step 330, the processor allows the user to start carrying out themotion.

In Step 340, the processor records the motion.

In Step 350, the processor stores the motion data to a motion database,which can be taken as an example of the database, and performs motionrecognition.

In Step 360, the processor detects that the user releases the buttonmentioned in Step 310, and therefore stops recording the motion to berecognized, where releasing this button is utilized as a command to stoprecording the motion to be recognized.

FIG. 18 is a working flow 400 involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention.

In Step 410, the processor detects that the user presses and holds abutton such as that mentioned in Step 310, and therefore the processorprepares for recording the motion and performing motion recognition,where pressing and holding this button is utilized as a command to startrecording the motion to perform motion recognition.

In Step 420, the processor sets the current yaw angle referring to theglobal coordinate system to be zero. As a result, the problem that theyaw angle changes of the same motion are not the same in differentsituations (with respect to different initial values of the yaw angle inthese situations) can be prevented.

In Step 430, under control of the processor, vibration occurs (e.g. theprocessor controls a vibrator of the electronic device to vibrate, whilewaiting for a predetermined time), where the vibration can be utilizedfor notifying the user that the user can start carrying out the motion.

In Step 440, the processor notifies the user that the user can startcarrying out the motion. For example, under control of the processor,the display module 170 may display a message for notifying that the usercan start carrying out the motion.

In Step 450, the processor records the motion data.

In Step 460, the processor stores the motion data to a motion databasesuch as that mentioned in Step 350 and performs motion recognition.

In Step 470, the processor detects that the user releases the buttonmentioned in Step 410, and therefore stops recording the motion to berecognized, where releasing this button is utilized as a command to stoprecording the motion to be recognized.

Motion Recognition Design Flow

FIG. 19 illustrates some relationships between a plurality of motionsand the associated motion data in a user-defined motion recognitiondatabase (e.g. the user-defined gesture database mentioned above)according to an embodiment of the present invention. As shown in FIG.19, the user may carry out various kinds of motions having differenttrajectories (e.g. those labeled “Motion 1”, “Motion 2”, . . . , and“Motion N” in the left half of FIG. 19), respectively. Under control ofthe processor, the user-defined motion recognition database is arrangedto store the motion data of these motions, respectively. For example,each of these motion trajectories may contain both translationinformation and rotational information, such as the linear accelerationand the orientation-angles (e.g. the roll, the yaw, and the pitch anglesof the orientation of the electronic device). As a result, the user candefine these motions in the user-defined motion recognition database,respectively.

For better comprehension, the motion data respectively corresponding tothe motions “Motion 1”, “Motion 2”, . . . , and “Motion N” illustratedin the left half of FIG. 19 are labeled “Motion 1”, “Motion 2”, . . . ,and “Motion N” within the data structure of the user-defined motiondatabase illustrated in the right half of FIG. 19. In practice, in asituation where the motions “Motion 1”, “Motion 2”, . . . , and “MotionN” illustrated in the left half of FIG. 19 are some user-definedgestures, the motion data respectively corresponding to the motions“Motion 1”, “Motion 2”, . . . , and “Motion N” within the data structureof the user-defined motion database illustrated in the right half ofFIG. 19 can be regarded as the gesture data corresponding to theseuser-defined gestures, and therefore can be re-labeled “Gesture 1”,“Gesture 2”, . . . , and “Gesture N”, respectively.

FIG. 20 illustrates some relationships between the associated motiondata respectively corresponding to the plurality of motions mentioned inthe embodiment shown in FIG. 19 and the associated sets of macrofunctions (e.g. those labeled “Macro functions NO. 1”, “Macro functionsNO. 2”, “Macro functions NO. 3”, . . . , and “Macro functions NO. N”)within the database, where the processor allows the user to define theserelationships in advance and update (e.g. edit) these relationships. Asshown in FIG. 20, when a motion such as that shown in the leftmost ofFIG. 20 is recognized as a specific motion within the plurality ofmotions (e.g. “Motion 1”), the processor triggers the associated set ofmacro functions (e.g. “Macro functions NO. 1”).

FIG. 21 is a working flow 500A involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention, where the working flow 500A can be utilized forcreation of motion-based macro function of the electronic device (e.g. acell phone).

In Step 510, the processor performs motion database creation, in orderto create the user-defined motion recognition database mentioned in theembodiment shown in FIG. 19.

In Step 520, the processor performs motion database training such asthat performed in the embodiment shown in FIG. 19. For example, themotion database training may represent a weighting parameter adjustmentprocess, for learning the motions.

In Step 530, the processor sets a series of macro functions of theelectronic device, the macro functions corresponding to motionrecognition results, respectively. As a result, the weighting parametersobtained from the weighting parameter adjustment process can be used fordetermining the recognition result based on the motion input.

FIG. 22 is a working flow 500B involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention, where the working flow 500A can be utilized forexecution of motion-based macro function of the electronic device (e.g.the cell phone mentioned above).

In Step 560, the processor detects the motion input.

In Step 570, under control of the processor, the motion recognitionresult comes out according to the motion database such as theuser-defined motion recognition database mentioned in the embodimentshown in FIG. 19.

In Step 580, the processor executes at least one macro function (moreparticularly, a set of macro functions) of the electronic device such asthe cell phone.

FIG. 23 illustrates some implementation details of Step 510 shown inFIG. 21 according to an embodiment of the present invention.

In Step 511, the processor detects Motion NO. k (more particularly, thesensor data thereof) generating, where the aforementioned “Motion NO. k”may represent one of the plurality of motions mentioned in theembodiment shown in FIG. 19, such as the motions labeled “Motion 1”,“Motion 2”, . . . , and “Motion N” in the left half of FIG. 19.

In Step 512, the processor calculates the associated linear accelerationand the associated orientation-angle(s).

In Step 513, the processor performs preprocessing, such as normalizationand feature extraction.

In Step 514, the processor stores the preprocessing result to thedatabase (e.g. the user-defined motion recognition database mentioned inthe embodiment shown in FIG. 19), for example, with NO. k gesture (or“Gesture k”, the k.sup.th gesture in the user-defined gesture database)being associated to the aforementioned Motion NO. k of Step 511.

In Step 515, the processor controls the index k of motion numbers to beincreased with an increment such as one.

In Step 516, the processor checks whether the next motion input exists.

In Step 517, under control of the processor, the motion database such asthe user-defined motion recognition database mentioned in the embodimentshown in FIG. 19 is completed.

In Step 518, the processor sets the training flag FLAG_train as “Active”(e.g. a state indicating that training is active, or a state indicatingthat training is required), allowing the motion database to be trained.

FIG. 24 illustrates some implementation details of Step 520 shown inFIG. 21 according to the embodiment shown in FIG. 23.

In Step 521, the processor checks whether the training flag FLAG_trainis set as “Active”.

In Step 522, the processor lists the current numbers of motion definedby the user.

In Step 523, the processor runs the training algorithm to generate thetraining parameters (e.g. the weighting parameters mentioned above)according to the number of motion pre-defined by the user.

In Step 524, under control of the processor, the motion databasetraining is completed.

In Step 525, the processor sets the training flag FLAG_train as“De-active”, which is typically the inverted state of “Active” mentionedin Step 518.

FIG. 25 illustrates some implementation details of Step 530 shown inFIG. 21 according to the embodiment shown in FIG. 23. As shown in FIG.25, the processor sets a series of macro functions of the electronicdevice (e.g. the cell phone), the macro functions corresponding tomotion recognition results, respectively, where the motion recognitionresults represent the recognized gestures, i.e. the recognized motion,which are carried out by the user. As a result, the recognized gestures(e.g. those labeled “Gesture 1”, “Gesture 2”, “Gesture 3”, . . . in theleft half of FIG. 25) can be utilized for triggering the associated setsof macro functions, respectively. For example, “Gesture 1” can beutilized for triggering a set of macro functions, such as the macrofunction {Function a}. In another example, “Gesture 2” can be utilizedfor triggering another set of macro functions, such as the macrofunctions {Function b, Function c, Function d}, which are performed inthe order shown in FIG. 25. In another example, “Gesture 3” can beutilized for triggering another set of macro functions, such as themacro functions {Function e, Function f, Function g, Function h}, whichare performed in the order shown in FIG. 25.

FIG. 26 illustrates some implementation details involved with theworking flow shown in FIG. 22 according to another embodiment of thepresent invention. Please note that the number of macro functions of theuser-defined macro function corresponding to the at least one motionrecognition result, can be regarded as a macro function count MFC.Typically, the macro function count MFC is a positive integer. Forexample, the macro function count MFC can be equal to three for therecognized motion (e.g. a specific gesture such as that labeled “Gesture2” in the left half of FIG. 25) in this embodiment. This is forillustrative purposes only, and is not meant to be a limitation of thepresent invention. According to a variation of this embodiment, themacro function count MFC can be equal to one for the recognized motion(e.g. a specific gesture such as that labeled “Gesture 1” in the lefthalf of FIG. 25). According to another variation of this embodiment, themacro function count MFC can be equal to four for the recognized motion(e.g. a specific gesture such as that labeled “Gesture 4” in the lefthalf of FIG. 25).

In Step 560-1, the processor detects the motion input and set an indexFLAG_MFC to be an initial value such as zero, in order to start countingthe executed macro functions in the working flow shown in FIG. 26.

In Step 570, under control of the processor, the motion recognitionresult comes out according to the motion database such as theuser-defined motion recognition database mentioned in the embodimentshown in FIG. 19.

In Step 581, the processor executes the corresponding macro functionNO.sub.T(FLAG_MFC), where the function NO.sub.T(FLAG_MFC) represents amapping relationship between the macro function to be executed in theouter loop comprising Step 581 (i.e. the loop formed with Step 581through to Step 584) and the index FLAG_MFC, and can be implemented byat least one table. In practice, the processor may store the definitionof the associated sets of macro functions mentioned in the embodimentshown in FIG. 20 (more particularly, the definition of the sets of macrofunctions shown in the right half of FIG. 25) into the table in advance.

For example, in a situation where the recognized motion is the gesturelabeled “Gesture 2” in the left half of FIG. 25, the macro functionsNO.sub.T(0), NO.sub.T(1), and NO.sub.T(2) represent the macro functions“Function b”, “Function c”, and “Function d”, respectively. That is, inStep 581, the processor may execute the macro function “Function b” whenFLAG_MFC=0, or execute the macro function “Function c” when FLAG_MFC=1,or execute the macro function “Function d” when FLAG_MFC=2.

In Step 582, the processor checks whether the operation of the macrofunction NO.sub.T(FLAG_MFC) finishes.

In Step 583, the processor increases the index FLAG_MFC with anincrement such as one.

In Step 584, the processor checks whether the index FLAG_MFC reaches themacro function count MFC.

In Step 585, under control of the processor, the operations of themotion-based macro functions are finished.

FIG. 27 illustrates a plurality of finger-touched steps for enabling aspecific application (such as a navigation application) according anembodiment of the present invention. As shown in FIG. 27, the processordetects that the user presses the hardware (HW) start button, andfurther detects that the user slides on the touch screen (or the touchpanel mentioned above) to unlock. Then, the processor allows the user toenter the password and then detects that the password is correct.Afterward, the processor triggers the Home page showing on the touchscreen, and then detects that the user turns on the GPS function of theGPS module mentioned above. Finally, the user opens the navigationapplication to use it.

FIG. 28 illustrates some implementation details of multi-steps functiondefinition including enabling the GPS function mentioned above accordingto another embodiment of the present invention. As shown in FIG. 28, aset of macro functions shown in FIG. 25 (more particularly, the set ofmacro functions illustrated around the bottom right corner of FIG. 25)is replaced by a set of operations, which may comprise sliding on thetouch screen to unlock (virtually or automatically), entering thepassword (virtually or automatically), turning on the GPS function(automatically), and opening the navigation application (automatically).That is, in response to a specific gesture such as that labeled “Gesture3”, the processor automatically prepares everything required for usingthe navigation application. As a result, using many finger-touched stepsfor enabling a specific application (such as a navigation application)is not needed.

FIG. 29 is a working flow 610 involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention, where the working flow 610 can be utilized for addingmotion(s) in the current motion database such as that obtained from theworking flow 500A. Thus, once the user finish the setting of the motiondatabase such as that in the embodiment shown in FIG. 21, they can stilladd any other motion gestures in the motion database.

In Step 611, the processor checks whether adding new motion in thecurrent database is requested by the user.

In Step 612, the processor detects a new Motion NO. k (moreparticularly, the sensor data thereof) generating. For example, theprocessor may control the initial value of the index k of motion numbersin the working flow 610 to be the final value of the index k of motionnumbers in the embodiment shown in FIG. 23, as if the working flow shownin FIG. 23 continues with the first new motion in the working flow 610,to update the current motion database. In another example, the processormay control the initial value of the index k of motion numbers in theworking flow 610 to be the final value of the index k of motion numbersin the previous execution of the same working flow 610.

In Step 613, the processor calculates the associated linear accelerationand the associated orientation-angle(s).

In Step 614, the processor performs preprocessing, such as normalizationand feature extraction.

In Step 615, the processor stores the preprocessing result to thedatabase (e.g. the user-defined motion recognition database mentioned inthe embodiment shown in FIG. 19), for example, with NO. k gesture (or“Gesture k”, the k.sup.th gesture in the user-defined gesture database)being associated to the aforementioned Motion NO. k of Step 612.

In Step 616, the processor controls the index k of motion numbers to beincreased with an increment such as one.

In Step 617, the processor checks whether the next motion input exists.

In Step 618, under control of the processor, the motion database iscompleted.

In Step 619, the processor sets the training flag FLAG_train as“Active”, allowing the motion database to be trained.

FIG. 30 is a working flow 620 involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention, where the working flow 620 can be utilized forre-training the updated database of the embodiment shown in FIG. 29 whena new motion is added.

In Step 621, the processor checks whether the training flag FLAG_trainis set as “Active”.

In Step 622, the processor lists the current numbers of motion definedby the user.

In Step 623, the processor runs the training algorithm to generate thetraining parameters (e.g. the weighting parameters mentioned above)according to the number of motion pre-defined by the user.

In Step 624, under control of the processor, the motion databasetraining is completed.

In Step 625, the processor sets the training flag FLAG_train as“De-active”.

FIG. 31 is a working flow 630 involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention, where the working flow 630 can be utilized fordeleting motion(s) in the current motion database such as that obtainedfrom the working flow 500A.

In Step 631, the processor checks whether deleting one motion in thecurrent database is requested by the user.

In Step 632, the processor detects that the user selects thecorresponding index of the motion to be deleted.

In Step 633, the processor clears all data of this motion.

In Step 634, the processor re-arranges the order of the index and itscorresponding motion stored in the motion database. As a result, theranking of at least one portion (e.g. a portion or all) of the remainingdata in the motion database may be adjusted, and therefore the remainingdata in the motion database can be accessed easily and correctly.

In Step 635, the processor controls the index k of motion numbers to bedecreased with a decrement such as one.

In Step 636, the processor checks whether the next motion to be deletedexists.

In Step 637, under control of the processor, the motion database iscompleted.

In Step 638, the processor sets the training flag FLAG_train as“Active”, allowing the motion database to be trained.

FIG. 32 is a working flow 640 involved with the method mentioned in theembodiment shown in FIG. 4 according to another embodiment of thepresent invention, where the working flow 640 can be utilized forre-training the updated database of the embodiment shown in FIG. 31 whenany motion is deleted.

In Step 641, the processor checks whether the training flag FLAG_trainis set as “Active”.

In Step 642, the processor lists the current numbers of motion definedby the user.

In Step 643, the processor runs the training algorithm to generate thetraining parameters (e.g. the weighting parameters mentioned above)according to the number of motion pre-defined by the user.

In Step 644, under control of the processor, the motion databasetraining is completed.

In Step 645, the processor sets the training flag FLAG_train as“De-active”.

Single/Multi-Stroke Character Motion Recognition

FIG. 33 illustrates some trajectories detected by single/multi-strokecharacter motion recognition involved with the method mentioned in theembodiment shown in FIG. 4 according to an embodiment of the presentinvention. As shown in FIG. 33, the processor can recognize thetrajectory made by the user as one of the characters pre-defined in thedatabase. For example, “d”, “m”, and “4” can be recognized as shown inthe right half of FIG. 33. Please refer to FIG. 34, which illustrateshand-writing motions having pitch and yaw angle changes with respect totime and the associated projection on an XZ plane (e.g. theaforementioned first plane parallel to the x-z plane) of the globalcoordinate system according to the embodiment shown in FIG. 33. Forexample, in a situation where the user is facing toward the XZ plane,the single/multi-stroke character motion carried out (or drawn) by theuser can be regarded as hand-writing motion having pitch and yaw anglechanges with respect to time on the XZ plane.

FIG. 35 illustrates the Spherical-Cartesian transformation according tothe embodiment shown in FIG. 33. For example, the processor is capableof performing the Spherical-Cartesian transformation according to thechanges of one or more of the pitch angle and the yaw angle (e.g. thechanges of the pitch angle and/or the changes of the yaw angle) togenerate the data of the 3D points in the 3D space. As a result, thepitch and the yaw angle changes with respect to time can be convertedinto 3D points (more particularly, the data thereof) in the 3D space bySpherical-Cartesian transformation shown in FIG. 35, so that thetrajectory of the hand-writing motion (or movement) can be stored intothe aforementioned database, and therefore the hand-writing motion canbe recognized. This is for illustrative purposes only, and is not meantto be a limitation of the present invention. According to a variation ofthis embodiment, the processor is capable of performing theSpherical-Cartesian transformation according to the changes of one ormore of the pitch angle and the roll angle (e.g. the changes of thepitch angle and/or the changes of the roll angle) to generate the dataof the 3D points in the 3D space. According to another variation of thisembodiment, the processor is capable of performing theSpherical-Cartesian transformation according to the changes of one ormore of the roll angle and the yaw angle (e.g. the changes of the rollangle and/or the changes of the yaw angle) to generate the data of the3D points in the 3D space.

FIG. 36 illustrates trajectory data extraction corresponding to theprojection on the XZ plane (e.g. the aforementioned first plane parallelto the x-z plane) of the global coordinate system for the aforementionedsingle/multi-stroke character motion recognition of the embodiment shownin FIG. 33 according to an embodiment of the present invention. When theuser is standing, facing toward the XZ plane, he/she can carry out thehand-writing motion as if he/she is writing onto the XZ plane, and theprocessor can record the 3D points of the trajectory, and then pick up(or extract) the 2D points from the 3D points, having no need to recordthe y-coordinates of the 3D points (i.e., the y-coordinates based on they-axis) in this embodiment, where these 2D points respectively havingthe remaining coordinates {(x, z)} can be utilized for performing motionrecognition.

FIG. 37 illustrates trajectory data extraction corresponding to theprojection on an XY plane (e.g. a third plane parallel to the x-y planecomprising the x-axis and the y-axis of the x-y-z coordinate system) ofthe global coordinate system for the aforementioned single/multi-strokecharacter motion recognition of the embodiment shown in FIG. 33according to another embodiment of the present invention. When the useris lying down, facing toward the XY plane, he/she can carry out thehand-writing motion as if he/she is writing onto the XY plane, and theprocessor can record the 3D points of the trajectory, and then pick up(or extract) the 2D points from the 3D points, having no need to recordthe z-coordinates of the 3D points (i.e., the z-coordinates based on thez-axis) in this embodiment, where these 2D points respectively havingthe remaining coordinates {(x, y)} can be utilized for performing motionrecognition.

According to the embodiments shown in FIG. 36 and FIG. 37, by using the2D points extracted from the 3D points with the projection onto any ofthe XY plane, the XZ plane, and the YZ plane, the motion recognition(more particularly, character recognition) can be performed correctly indifferent situations, no matter whether the user is standing, sitting,or lying. In practice, no matter whether the user is standing or lying,the pitch angle of the electronic device can be utilized for determiningthe current status (e.g. the user is standing, or the user is lying),and the processor can select the predetermined plane correctly based onthe detection of the current status (e.g. the user is standing, or theuser is lying).

FIG. 38 illustrates some characters drawn by the user and the associatedstroke counts involved with the aforementioned single/multi-strokecharacter motion recognition of the embodiment shown in FIG. 33according to an embodiment of the present invention. The characterssometimes may comprise multi-strokes, which means it is required toprovide the user with a method to write trajectories of multi-strokescharacters in the 3D space. According to this embodiment, a button (forthe user to press and hold, and to release) can be utilized fordistinguishing separated strokes. For example, the third character shownin FIG. 38 (labeled “3.”, above the character) can be introduced to theuser if he/she can follow the writing order of this stroke. As a result,the user still can get the character “4” after motion recognition,without exceeding one stroke.

FIG. 39 is a working flow 700 involved with the aforementionedsingle/multi-stroke character motion recognition of the embodiment shownin FIG. 33 according to an embodiment of the present invention.

In Step 710, the processor detects that the user presses and holds abutton such as that mentioned in Step 310, and therefore the processorprepares for recording the motion and performing motion recognition,where pressing and holding this button is utilized as a command to startrecording the motion to perform motion recognition.

In Step 720, the processor sets the current yaw angle referring to theglobal coordinate system to be zero degree (or zero).

In Step 730, the processor allows the user to start hand-writing in the3D space.

In Step 740, the processor stores the trajectories data of this handwriting as 2D points {(xn(tn), yn(tn)), (xn(tn), zn(tn)), (yn(tn),zn(tn))}, which are coordinate sets having the coordinates (x(t), y(t)),(x(t), z(t)), (y(t), z(t)), where the notation t represents time, andthe notation n represents a positive integer utilized as an index fordenoting the n.sup.th point (e.g. on the trajectory) corresponding tothe global Cartesian coordinate, and therefore the notation tnrepresents a time point of a plurality of discrete time points on thetime axis. Thus, the notations xn, yn, zn represent data (e.g. globalCartesian coordinate data) corresponding to the time point tn. Forexample, {xn(tn)} may comprise xn(tn), xn−1(tn−1), xn−2(tn−2), . . . ,.xm(tm), where m<n.

In practice, (xn(tn), yn(tn)), (xn(tn), zn(tn)), and (yn(tn), zn(tn))may represent a set of 2D points, and more particularly, the coordinatesof different locations on the trajectory under consideration. This isfor illustrative purposes only, and is not meant to be a limitation ofthe present invention. According to some variations of this embodiment,each of (xn(tn), yn(tn)), (xn(tn), zn(tn)), and (yn(tn), zn(tn)) mayrepresent a set of 2D points from current instant time n to previous 2Dpoints.

In Step 750, the processor extracts the features of these 2D points andruns character recognition, for example, with the features beingcompared with the data in the database.

In Step 760, under control of the processor, the character recognitionresult comes out.

In Step 770, the processor executes at least one macro function (moreparticularly, a set of macro functions) of the electronic device such asthe cell phone.

FIG. 40 is a working flow 800 involved with the aforementionedsingle/multi-stroke character motion recognition of the embodiment shownin FIG. 33 according to another embodiment of the present invention.

In Step 810, the processor detects that the user presses and holds abutton such as that mentioned in Step 310, and therefore the processorprepares for recording the motion and performing motion recognition,where pressing and holding this button is utilized as a command to startrecording the motion to perform motion recognition.

In Step 820, the processor sets the current yaw angle referring to theglobal coordinate system to be zero degree (or zero).

In Step 830, the processor allows the user to start hand-writing in the3D space.

In Step 840, the processor stores the trajectories data of this handwriting as 2D points {(xn(tn), yn(tn)), (xn(tn), zn(tn)), (yn(tn),zn(tn))}, such as those disclosed above.

In Step 850, under control of the processor, the 2D points are loadedinto a character recognition software, for character recognition.

In Step 860, under control of the processor, the character recognitionresult comes out.

In Step 870, the processor executes at least one macro function (moreparticularly, a set of macro functions) of the electronic device such asthe cell phone.

Those skilled in the art will readily observe that numerousmodifications and alterations of the device and method may be made whileretaining the teachings of the invention. Accordingly, the abovedisclosure should be construed as limited only by the metes and boundsof the appended claims.

The invention claimed is:
 1. A method performed by a processor of anelectronic device configured to be held by a user, the methodcomprising: obtaining sensor data corresponding to a plurality of motionsensors of the electronic device, the sensor data being measured withrespect to a device coordinate system of the electronic device, whereinthe plurality of motion sensors comprises inertial motion sensors;performing sensor fusion according to the sensor data to obtain anorientation comprising resultant angles in a spatial reference frame ofa global coordinate system, wherein the resultant angles comprise a rollangle, a pitch angle, and a yaw angle of the electronic device;selecting one of at least one predetermined plane based on theorientation; mapping the resultant angles onto the selected one of theat least one predetermined plane to obtain a trajectory on the selectedone of the at least one predetermined plane; and performing motionrecognition based on the trajectory on the selected one of the at leastone predetermined plane in the spatial reference frame in order torecognize the user's motion in 3D space, wherein performing motionrecognition further comprises: performing motion recognition based onthe trajectory on the selected one of the at least one predeterminedplane at the spatial reference frame in order to recognize at least onecharacter drawn by the user in the 3D space; loading the at least onecharacter drawn by the user in the 3D space into a character recognitionsoftware module configured to perform character recognition; andperforming character recognition comprising resetting the yaw angle ofthe electronic device to a predetermined value to align the yaw anglewith the user; and wherein, in mapping the resultant angles, the leastone predetermined plane is parallel to two of three axes of the globalcoordinate system, and the three axes of the global coordinate systemare orthogonal to each other.
 2. The method of claim 1, wherein: theplurality of motion sensors comprises at least one rotation sensor; andperforming the sensor fusion comprises utilizing the at least onerotation sensor.
 3. The method of claim 2, wherein: the plurality ofmotion sensors comprises at least one magnetometer; and performing thesensor fusion comprises utilizing the at least one magnetometer.
 4. Themethod of claim 1, further comprising: providing a pre-built characterrecognition database in the electronic device corresponding to movingrules associated with characters to be recognized.
 5. The method ofclaim 1, further comprising: resetting the yaw angle of the electronicdevice to the predetermined value in response to a button of theelectronic device being pressed.
 6. The method of claim 1, furthercomprising: resetting the yaw angle of the electronic device to thepredetermined value in response to detecting onset of motion.
 7. Themethod of claim 1, further comprising: performing Spherical-Cartesiantransformation according to changes of one or more of the pitch angle,roll angle, and the yaw angle to generate data of 3D points in the 3Dspace.
 8. The method of claim 1, wherein: performing motion recognitioncomprises obtaining at least one motion recognition result representingthe user's motion in the 3D space; and the method further comprisestriggering at least one user-defined macro function corresponding to theat least one motion recognition result.
 9. The method of claim 8,wherein: the method further comprises providing a user-defined gesturedatabase in the electronic device; and obtaining the at least one motionrecognition result comprises using the user-defined gesture database.10. An electronic device configured to be held by a user, comprising: aplurality of motion sensors configured to generate sensor data measuredwith respect to a device coordinate system, wherein the plurality ofmotion sensors comprises inertial motion sensors; a processor havingprocessor circuitry configured to: perform sensor fusion according tothe sensor data to obtain an orientation comprising resultant angles ina spatial reference frame of a global coordinate system, wherein theresultant angles comprises a roll angle, a pitch angle, and a yaw angleof the electronic device; select one of at least one predetermined planebased on the orientation; map the resultant angles onto the selected oneof the at least one predetermined plane to obtain a trajectory on theselected one of the at least one predetermined plane; perform motionrecognition based on the trajectory on the selected one of the at leastone predetermined plane in the spatial reference frame in order torecognize the user's motion in 3D space; and reset the yaw angle of theelectronic device to a predetermined value to align the yaw angle withthe user; wherein, in mapping the resultant angles, the least onepredetermined plane is parallel to two of three axes of the globalcoordinate system, and the three axes of the global coordinate systemare orthogonal to each other.
 11. The device of claim 10, wherein: theplurality of motion sensors comprises at least one rotation sensor; andthe processor is configured to perform the sensor fusion utilizing theat least one rotation sensor.
 12. The device of claim 11, wherein: theplurality of motion sensors comprises at least one magnetometer; and theprocessor is configured to perform the sensor fusion utilizing the atleast one magnetometer.
 13. The device of claim 10, wherein theprocessor is further configured to perform motion recognition based onthe trajectory on the selected one of the at least one predeterminedplane at the spatial reference frame in order to recognize at least onecharacter drawn by the user in the 3D space, further comprising: apre-built character recognition database corresponding to drawing rulesassociated with characters to be recognized such that the processoraccesses the pre-built character recognition database during motionrecognition.
 14. The device of claim 10, further comprising: a characterrecognition software module configured to perform character recognitionduring the performing of motion recognition.
 15. The device of claim 10,wherein: in performing the motion recognition, the processor isconfigured to obtain at least one motion recognition result representingthe user's motion in the 3D space; and the processor is furtherconfigured to trigger at least one user-defined macro functioncorresponding to the at least one motion recognition result.
 16. Thedevice of claim 15, wherein: the device further comprises a user-definedgesture database; and the processor is configured to obtain the at leastone motion recognition result using the user-defined gesture database.